package cn.vcjf.washcar.mpGenerator;

import cn.vcjf.washcar.common.util.QiniuUploadFile;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @Auther: zhengzihang
 * @Date: 2018/7/18 17:31
 * @Description:
 */
public class CarBrand {


	public static void main(String[] args) throws Exception {

		FileReader reader=new FileReader("D://Downloads/cars.json");
		BufferedReader bf=new BufferedReader(reader);
		StringBuffer buffer = new StringBuffer(614400);
		String s = null;
		while ((s = bf.readLine())!=null){
			buffer.append(s);
		}
		JSONObject object = JSON.parseObject(buffer.toString());
		Set<Map.Entry<String, Object>> entries = object.entrySet();

		for(Map.Entry<String, Object> entry: entries){
			System.out.println("---"+entry.getKey());
			Object value = entry.getValue();
			List<Map<String,String>> list = (List<Map<String,String>>) value;
			for(Map<String,String> m:list){
				String name = m.get("name");
				String img = m.get("img");
				//  data:image/png;base64,
				System.out.println("name="+name+"\t,img="+img);
				String s1 = QiniuUploadFile.put64(img);

				return;
			}

		}
	}
}
